package com.sg.service.impl;

import com.github.pagehelper.PageHelper;
import com.sg.bean.Invitation;
import com.sg.dao.InvitationDao;
import com.sg.service.InvitationService;
import com.sg.vo.InvitationVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zh
 * 帖子业务逻辑接口实现
 */
@Service
public class InvitationServiceImpl implements InvitationService {
    @Resource
    @Autowired
    InvitationDao invitationDao;
    @Override
    public List<InvitationVO> findAll() {
        return invitationDao.findAll();
    }

    @Override
    public InvitationVO findById(int invitationId) {
        return invitationDao.findById(invitationId);
    }

    @Override
    public List<InvitationVO> findByTitle(String title) {
        return invitationDao.findByTitle(title);
    }

    @Override
    public boolean add(Invitation invitation) {
        return invitationDao.add(invitation)>0?true:false;
    }

    @Override
    public boolean update(InvitationVO invitationVO) {
        return invitationDao.update(invitationVO)>0?true:false;
    }

    @Override
    public boolean delete(int invitationId) {
        return invitationDao.delete(invitationId)>0?true:false;
    }

    @Override
    public List<InvitationVO> findAllPage(int pageNum, int pageSize) {
        //开启分页
        PageHelper.startPage(pageNum,pageSize);
        return invitationDao.findAll();
    }

    @Override
    public List<InvitationVO> findByName(String isName) {
        return invitationDao.findByName(isName);
    }


}
